package com.dragonsky.shop.product.controller;

import com.dragonsky.shop.common.utils.AjaxResult;
import com.dragonsky.shop.dubbo.product.service.ProductDubboService;
import com.dragonsky.shop.product.domain.vo.ProductNaCosVo;
import com.dragonsky.shop.product.service.ProductService;
import jakarta.annotation.Resource;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 产品表 前端控制器
 * </p>
 *
 * @author dragon
 * @since 2025-03-22 00:16:00
 */
@RestController
@RequestMapping("/product")
public class ProductController {

    @Resource
    private ProductService productService;

    @DubboReference
    private ProductDubboService productDubboService;


    @GetMapping("/getNaCosConfig")
    public AjaxResult<ProductNaCosVo> getNaCosConfig() {
        return productService.getNaCosConfig();
    }

    @GetMapping("/seata")
    public AjaxResult<Void> seata() {
        return productService.seata();
    }

    @GetMapping("/dubbo")
    public AjaxResult<String> dubbo() {
        String productName = productDubboService.productName(1L);

        return AjaxResult.succeedWith(productName);
    }

}
